<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" 	prefix="s"%>
<%@ include file="/jsp/common/common_head.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
<title>示界港管理平台</title>
<%@ include file="/jsp/common/common_script.jsp"%>
<style type="text/css">
	input[disabled],textarea[disabled]{background:lightgrey};
</style>
<script type="text/javascript">
 var g_userId = '<%=session.getAttribute("userId")%>';
</script>
</head>
<body>
<table class="queryTable" >
	<tr>	
		<td class="queryTitle" width="80px">批次号</td>
		<td class="queryContent">
			<select id="queryYhLot" class="easyui-combobox" panelHeight="280px" editable="false" style="width: 150px;">
			</select>
		</td>
		<td class="queryTitle" width="80px">状态</td>
		<td class="queryContent">
			<select id="queryYhState" class="easyui-combobox" panelHeight="auto" editable="false" style="width: 100px">
				<option value="0" selected>[不限]</option>
				<option value="10">尚未兑换</option>
				<option value="15">已领取</option>
				<option value="20">已兑换</option>
				<option value="30">已下单</option>
				<option value="40">已使用</option>
			</select>
		</td>
		<td class="queryTitle" width="80px">持有组织</td>
		<td class="queryContent">
			<select id="queryYhOrg" class="easyui-combobox" panelHeight="auto" editable="false" style="width: 160px">
			</select>
		</td>
		<td class="queryTitle" width="80px">持有人</td>
		<td class="queryContent">
			<select id="queryYhOwner" class="easyui-combobox" panelHeight="200px" editable="false" style="width: 160px">
			</select>
		</td>
	</tr>
	<tr>
		<td class="queryTitle" width="80px">优惠券码</td>
		<td class="queryContent">
			<input class="inputText" type="text" id="queryYhCode" />
		</td>
		<td class="queryTitle" width="80px">优惠券类型</td>
		<td class="queryContent">
			<select id="queryYhType" class="easyui-combobox" panelHeight="auto" editable="false" style="width: 100px">
				<option value="0" selected>[不限]</option>
				<option value="10">直接抵扣</option>
				<option value="20">满减券</option>
				<option value="30">折扣券</option>
			</select> 
		</td>
		<td class="queryTitle" width="80px">有效开始日期</td>
		<td class="queryContent">
			<input id="queryExpiryDateStart" class="easyui-datebox" style="width:160px">
		</td>
		<td class="queryTitle" width="80px">有效截止日期</td>
		<td class="queryContent">
			<input id="queryExpiryDateEnd" class="easyui-datebox" style="width:160px">
		</td>
	</tr>
	<tr>
		<td class="queryTitle" width="80px">用途</td>
		<td class="queryContent">
			<select id="queryYhUse" class="easyui-combobox" panelHeight="auto" editable="false" style="width: 150px">
				<option value="0" selected>[不限]</option>
				<option value="10">通用</option>
				<option value="20">APP抽奖用[印品]</option>
				<option value="30">合伙人抽奖用[印品]</option>
				<option value="31">合伙人抽奖用[会员充值]</option>
				<option value="32">合伙人抽奖用[LOGO]</option>
				<option value="40">指定发放</option>
			</select>
		</td>
		<td class="queryTitle" width="80px">限定范围</td>
		<td class="queryContent">
			<select id="queryYhLimit" class="easyui-combobox" panelHeight="auto" editable="false" style="width: 100px">
				<option value="0" selected>[不限]</option>
				<option value="1">海报模版</option>
				<option value="2">多页模版</option>
				<option value="3">PPT模版</option>
				<option value="4">印品</option>
				<option value="9">虚拟商品</option>
				<option value="1010">Logo商品</option>
			</select>
		</td>
		<td class="queryTitle" width="80px">优惠券ID:</td>
		<td class="queryContent">
			<input class="inputText" type="text" id="queryCodeId" />
		</td>
		<td class="queryBtnTd" colspan="2">
			<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search"  onclick="doQuery()">查询</a>
		</td>
	</tr>
</table>

<table id="couponGrid"></table>

<div id="editDlg" class="easyui-window" title="" closed="true" style="width:780px; height:420px;text-align:center; background: #fff;">
	<div border="false" style="padding-left:10px;padding-right:10px;">
		<form id="editForm"  method="POST">
			<s:hidden name="editYhId" id="editYhId"/>
			<table border="0" class="queryTable" width="95%" height="auto" style="margin-bottom:0px;" id="editTable">
				<tr>
					<td class="queryTitle" width="100px">券类型</td>
					<td class="queryContent">
						<select id="editYhType" class="easyui-combobox" panelHeight="auto" editable="false" style="width: 140px">
							<option value="10" selected>直接抵扣</option>
							<!-- <option value="20">满减券</option>
							<option value="30">折扣券</option> -->
						</select>
					</td>
					<td class="queryTitle" width="120px">券用途</td>
					<td class="queryContent">
						<select id="editYhUse" class="easyui-combobox" panelHeight="auto" editable="false" style="width: 200px">
							<option value="10" selected>通用</option>
							<option value="20">APP抽奖用[印品]</option>
							<option value="30">合伙人抽奖用[印品]</option>
							<option value="31">合伙人抽奖用[会员充值]</option>
							<option value="32">合伙人抽奖用[LOGO]</option>
							<option value="40">指定发放</option>
						</select>
					</td>
				</tr>
				<tr>	
					<td class="queryTitle" width="100px">持有组织</td>
					<td class="queryContent">
						<select id="editYhOrg" class="easyui-combobox" panelHeight="auto" editable="false" style="width: 200px">
						</select>
					</td>
					<td class="queryTitle" width="100px">持有人</td>
					<td class="queryContent">
						<select id="editYhOwner" class="easyui-combobox" panelHeight="200px" editable="false" style="width: 200px">
						</select>
					</td>
				</tr>
				<tr>	
					<td class="queryTitle" width="100px">优惠额度(分)</td>
					<td class="queryContent">
						<s:textfield id="editYhDiscount" cssClass="inputText easyui-validatebox" data-options="required:true" onkeyup="value=value.replace(/[^\d]/gi,'')" cssStyle="width:140px"/>
					</td>
					<td class="queryTitle" width="120px">最小订单金额(分)</td>
					<td class="queryContent">
						<s:textfield id="editYhMinOrderFee" cssClass="inputText easyui-validatebox" data-options="" onkeyup="value=value.replace(/[^\d]/gi,'')" cssStyle="width:140px"/>
					</td>
				</tr>
				<tr>
					<td class="queryTitle" width="100px">限制范围</td>
					<td class="queryContent">
						<select id="editYhLimit" class="easyui-combobox" panelHeight="auto" editable="false" style="width:140px">
							<option value="0">[不限]</option>
							<option value="1">海报模版</option>
							<option value="2">多页模版</option>
							<option value="3">PPT模版</option>
							<option value="4" selected>印品</option>
							<option value="9">虚拟商品</option>
							<option value="1010">Logo商品</option>
						</select>
					</td>
					<td class="queryTitle" width="120px">有效截止时间</td>
					<td class="queryContent">
						<input id="editYhExpiryTime" class="easyui-datebox" style="width:140px">
					</td>
				</tr>
				<tr>
					<td class="queryTitle" width="100px">描述信息</td>
					<td class="queryContent" colspan="3">
						<textarea id="editYhDesc" name="editTopicDesc" rows="2" cols="55" class="inputText easyui-validatebox" style="width:100%;resize:none;" data-options="required:true,validType:['maxLength[180]']"></textarea>
					</td>
				</tr>
				<tr>
					<td class="queryTitle" width="100px">
						<input type="checkbox" id="editYhGrantFlg" onclick="clickGrantFlg(this)">批量指定发放</input>
					</td>
					<td class="queryContent" colspan="3">
						<textarea id="editYhGrantM" name="editYhGrantM" disabled="disabled" rows="6" cols="55" placeholder="请填入指定用户的手机号(多个以半角逗号','分隔)..." class="inputText easyui-validatebox" style="width:100%;resize:none;" data-options="required:true,validType:['maxLength[8000]']"></textarea>
					</td>
				</tr>
				<tr>
					<td class="queryTitle" width="100px">生成数量</td>
					<td class="queryContent">
						<s:textfield id="editYhGenCnt" cssClass="inputText easyui-validatebox" data-options="required:true" onkeyup="value=value.replace(/[^\d]/gi,'')" cssStyle="width:140px"/>
					</td>
				</tr>
			</table>
		</form>
	</div>
	<div style="clear:both;padding-top:10px;margin-bottom:10px;text-align:center;" id="editBtn">
		<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)" onclick="doEdit()">确定</a>
		<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="cancelEdit()">取消</a>
    </div>
</div>

<div id="exportDlg" class="easyui-window" title="" closed="true" style="width:400px; height:180px;text-align:center; background: #fff;">
	<div border="false" style="padding-left:10px;padding-right:10px;">
		<form id="exportForm"  method="POST">
			<table border="0" class="queryTable" width="95%" height="auto" style="margin-bottom:0px;" id="editTable">
				<tr>	
					<td class="queryTitle" width="100px">导出批次号</td>
					<td class="queryContent">
						<select id="exportLot" class="easyui-combobox" panelHeight="200px" editable="false" style="width: 180px">
						</select>
					</td>
				</tr>
			</table>
		</form>
	</div>
	<div style="clear:both;padding-top:10px;margin-bottom:10px;text-align:center;" id="exportBtn">
		<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)" id="downA">导出</a>
		<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="cancelExport()">取消</a>
    </div>
</div>

<div id="cacheDlg" class="easyui-window" title="" closed="true" style="width:500px; height:240px;text-align:center; background: #fff;">
	<div border="false" style="padding-left:10px;padding-right:10px;">
		<form id="cacheForm"  method="POST">
			<table border="0" class="queryTable" width="95%" height="auto" style="margin-bottom:0px;" id="cacheTable">
				<tr>
					<td class="queryTitle" width="100px">选择奖池</td>
					<td class="queryContent">
						<select id="cacheUse" class="easyui-combobox" panelHeight="auto" editable="false" style="width: 180px">
							<option value="20" selected>新版本APP抽奖用[印品]</option>
							<option value="30">合伙人抽奖用[印品]</option>
							<option value="31">合伙人抽奖用[会员充值]</option>
							<option value="32">合伙人抽奖用[LOGO]</option>
						</select>
					</td>
				</tr>
				<tr>
					<td class="queryTitle" width="100px">奖池当前券数</td>
					<td class="queryContent">
						<span id="cacheCnt" style="color:red"></span>
					</td>
					<td class="queryContent">
						<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search"  onclick="doCacheCnt()">查询</a>
					</td>
				</tr>
				<tr>
					<td class="queryTitle" width="100px">设置奖池券数<br/>*最大2000</td>
					<td class="queryContent">
						<s:textfield id="cacheSetCnt" cssClass="inputText easyui-validatebox" data-options="required:true" onkeyup="value=value.replace(/[^\d]/gi,'')" cssStyle="width:180px"/>
					</td>
					<td class="queryContent">
						<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-reload"  onclick="doCacheSet()">设置</a>
					</td>
				</tr>
			</table>
		</form>
	</div>
	<div style="clear:both;padding-top:10px;margin-bottom:10px;text-align:center;" id="cacheBtn">
		<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="closeCacheDlg()">关闭</a>
    </div>
</div>

<div id="grantDlg" class="easyui-window" title="" closed="true" style="width:600px; height:300px;text-align:center; background: #fff;">
	<div border="false" style="padding-left:10px;padding-right:10px;">
		<form id="grantForm"  method="POST">
			<s:hidden name="grantCId" id="grantCId"/>
			<table border="0" class="queryTable" width="95%" height="auto" style="margin-bottom:0px;" id="grantTable">
				<tr>
					<td class="queryTitle" width="100px"><span style="color:red">优惠码</span></td>
					<td class="queryContent" colspan="3">
						<span id="grantCCd" style="color:red"></span>
					</td>
				</tr>
				<tr>	
					<td class="queryTitle" width="100px"><span style="color:blue;">用户ID</span></td>
					<td class="queryContent" >
						<input class="easyui-textbox" id="grantUserId" style="width:100px;">
					</td>
					<td class="queryContent" >
						<a class="easyui-linkbutton" id="grantUserBtn" iconCls="icon-add" href="javascript:void(0)" onclick="showUserInfo()">选择用户</a>
					</td>
				</tr>
				<tr>
					<td class="queryTitle" width="100px">有效截止时间</td>
					<td class="queryContent" colspan="3">
						<input id="grantExpiryTime" class="easyui-datebox" style="width:140px">
					</td>
				</tr>
				<tr>	
					<td class="queryTitle" width="100px">描述信息</td>
					<td class="queryContent" colspan="3">
						<textarea id="grantDesc" name="grantDesc" rows="5" cols="55" class="inputText easyui-validatebox" style="width:100%;resize:none;" data-options="required:true,validType:['maxLength[180]']"></textarea>
					</td>
				</tr>
			</table>
		</form>
	</div>
	<div style="clear:both;padding-top:10px;margin-bottom:10px;text-align:center;" id="grantBtn">
		<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)" onclick="doGrant()">确定</a>
		<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="cancelGrant()">取消</a>
    </div>
</div>

<div id="userInfoDlg" class="easyui-window" title="" closed="true" style="width:1000px;height:500px;text-align:center; background: #fff;">
	<form id="userInfoForm"  style="padding-left:10px;padding-right:10px;" method="POST">
		<s:hidden name="sUserId" id="sUserId"/>
		<table class="queryTable" id="userInfoTable">
			<tr>
				<td class="queryTitle" width="80px">手机号</td>
				<td class="queryContent">
					<input class="inputText" type="text" style="width:120px;" id="queryUserInfoMobile"/>
				</td>
				<td class="queryTitle" width="68px">用户昵称</td>
				<td class="queryContent">
					<input class="inputText" type="text" style="width:120px;" id="queryUserInfoNickname"/>
				</td>
				<td class="queryTitle" width="80px">用户ID</td>
				<td class="queryContent">
					<input class="inputText" type="text" style="width:120px" id="queryUserInfoId" />
				</td>
				<td class="queryTitle" height="20px">
					<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search"  onclick="doUserInfoQuery(1)">查询</a>
				</td>
			</tr>
		</table>
		<div style="width:960px;height:350px;">
			<table id="userInfoGrid"></table>
		</div>
	</form>
	<div style="clear:both;padding-top:10px;margin-bottom:10px;text-align:center;" id="userInfoBtn">
		<a class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)" onclick="doSelUser()">确认</a>
		<a class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="cancelSelUser()">取消</a>
	</div>
</div>

<script type="text/javascript" src="${ctx}/js/trade/couponInfo.js"></script>
<script type="text/javascript" src="${ctx}/js/encrypt/encrypted-min.js"></script>
</body>
</html>
